/***************************************************
Class: stdafx
Includes: Listed below
Editors: Gindi
Existing Issues: None
Description: Windows and DirectX header files declared here, along with additional dependencies, aswell as global structs and macros.
***************************************************/

// Program layout and design inspired from project "Frustum Culling" by Chad Vernon
// URL : http://www.c-unit.com

#pragma once

#define DIRECTINPUT_VERSION 0x0800

// windows header file
#include <windows.h>

// runtime header files
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>

// directX header files
#include <d3d9.h>
#include <d3dx9.h>
#include <dinput.h>
#include <d3dx9tex.h>
#include <d3dx9core.h>
#include <d3dx9math.h>

// misc. header files
#include <cmath>
#include <fstream>
#include <list>
#include <string>
#include <time.h>
#include <fstream>
#include "GlobalVars.h"
#include "GlobalFunctions.h"
#include "Structs.h"
#include <deque>

using namespace std;

#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")
#pragma comment (lib, "dxerr.lib")
#pragma comment (lib, "dinput8.lib")
#pragma comment (lib, "dxguid.lib")
#pragma comment (lib, "dsound.lib")
#pragma comment (lib, "winmm.lib")

// Useful macros
#define SAFE_RELEASE(x)				if(x) { (x)->Release();		(x) = NULL; }
#define SAFE_DELETE(x)				if(x) { delete(x);			(x) = NULL; }
#define SAFE_DELETE_ARRAY(x)		if(x) { delete [] (x);		(x) = NULL; }
#define SHOWERROR(s,f,l)			char buf[1024];				sprintf_s(buf, sizeof(buf), "[File] %s\n\n[Line] %d\n\n[Error] %s",f,l,s);	MessageBox(0, buf, "Error", 0);
#define PRINT						_cprintf
#define NEXT_LINE					_cprintf("\n");
#define ToRad						D3DXToRadian
#define ToDeg						D3DXToDegree
#define ITERATOR(x)					list<x>::iterator

struct INTPair {
	int x;
	int y;
};

struct WeaponInfo {
	float		accuracyOffset;
	float		fireRate;			// 1 shot per #seconds (decimal for miliseconds)
	float		fireTime;
	float		maxVelocity;
	float		range;
	float		weaponDmg;
	string		modelFile;
	string		soundFile;
	string		trigger;
	string		type;
};

struct UnitInfo {
	int					group;
	int					level;
	float				LOS;
	float				shootRange;
	bool				canMove;
	string				soundFile;
	string				stance;
	string				status;
	list<WeaponInfo>	weapons;
};

struct PhysicsInfo {
	D3DXVECTOR3		destination;
	D3DXVECTOR3		dirLook;
	D3DXVECTOR3		dirPoint;
	D3DXVECTOR3		velocity;
	// lari
	D3DXVECTOR3		m_prevDirLook;
	// end:lari
	float			turningSpeed;
	float			maxVelocity;
	float			maxTurningSpeed;
};

struct PlayerMapsInfo {
	int highscore;
	string map;
};

struct PreGamePlayerInfo {
	int cScore;
	int creds;
	int lvl;
	int hScore;
	float hpRegen;
	float maxHealth;
	float maxVelocity;
	float maxTurningSpeed;
	float accuracyOffset;
	float fireRate;
	float wMaxVelocity;
	float range;
	float weaponDmg;
	string name;
	string modelFile;
	string soundFile;
	string wModelFile;
	string wSoundFile;
	string trigger;
	string type;
	string mName;
	list<WeaponInfo> weapons;
	list<PlayerMapsInfo> maps;
};
